********* Table A11 *********
clear all
set more off 
capture log close
 
* main path to data
global path "~/Dropbox/Paraguay/1_data/7_replication_dataverse"
capture cd "$path"	

*tables = analysis tables
global tables "$path/tables"


* main panel
use "$path/data/main.dta", clear

xtset id year


// Generate indicator variables for years 1954 to 2007
forval year = 1954/2007 {
    generate y`year' = (year == `year')
}

// Generate the alt_1989 variable and set it to 0
generate alt_1989 = 0



set more off
	reghdfe tmh_ha_log zbetweenness  ///
			 y1954#c.zbetweenness y1955#c.zbetweenness y1956#c.zbetweenness ///
			y1957#c.zbetweenness y1958#c.zbetweenness y1959#c.zbetweenness y1960#c.zbetweenness ///
			y1961#c.zbetweenness y1962#c.zbetweenness y1963#c.zbetweenness y1964#c.zbetweenness ///
			y1965#c.zbetweenness y1966#c.zbetweenness y1967#c.zbetweenness y1968#c.zbetweenness ///
			y1969#c.zbetweenness y1970#c.zbetweenness y1971#c.zbetweenness y1972#c.zbetweenness ///
			y1973#c.zbetweenness y1974#c.zbetweenness y1975#c.zbetweenness y1976#c.zbetweenness ///
			y1977#c.zbetweenness y1978#c.zbetweenness y1979#c.zbetweenness y1980#c.zbetweenness ///
			y1981#c.zbetweenness y1982#c.zbetweenness y1983#c.zbetweenness y1984#c.zbetweenness ///
			y1985#c.zbetweenness y1986#c.zbetweenness y1987#c.zbetweenness y1988#c.zbetweenness ///
			alt_1989    ///
			y1990#c.zbetweenness  y1991#c.zbetweenness y1992#c.zbetweenness y1993#c.zbetweenness ///
			y1994#c.zbetweenness y1995#c.zbetweenness  y1996#c.zbetweenness y1997#c.zbetweenness ///
			y1998#c.zbetweenness y1999#c.zbetweenness  y2000#c.zbetweenness y2001#c.zbetweenness ///
			y2002#c.zbetweenness y2003#c.zbetweenness  y2004#c.zbetweenness y2005#c.zbetweenness ///
			y2006#c.zbetweenness y2007#c.zbetweenness  ///
			zbetweenness [pweight=p_weights] if sample_weight == 1, absorb(year id) cluster(id) nocons

			eststo
			


set more off
reghdfe tmh_e zbetweenness ///
			 y1954#c.zbetweenness y1955#c.zbetweenness y1956#c.zbetweenness ///
			y1957#c.zbetweenness y1958#c.zbetweenness y1959#c.zbetweenness y1960#c.zbetweenness ///
			y1961#c.zbetweenness y1962#c.zbetweenness y1963#c.zbetweenness y1964#c.zbetweenness ///
			y1965#c.zbetweenness y1966#c.zbetweenness y1967#c.zbetweenness y1968#c.zbetweenness ///
			y1969#c.zbetweenness y1970#c.zbetweenness y1971#c.zbetweenness y1972#c.zbetweenness ///
			y1973#c.zbetweenness y1974#c.zbetweenness y1975#c.zbetweenness y1976#c.zbetweenness ///
			y1977#c.zbetweenness y1978#c.zbetweenness y1979#c.zbetweenness y1980#c.zbetweenness ///
			y1981#c.zbetweenness y1982#c.zbetweenness y1983#c.zbetweenness y1984#c.zbetweenness ///
			y1985#c.zbetweenness y1986#c.zbetweenness y1987#c.zbetweenness y1988#c.zbetweenness ///
			alt_1989    ///
			y1990#c.zbetweenness  y1991#c.zbetweenness y1992#c.zbetweenness y1993#c.zbetweenness ///
			y1994#c.zbetweenness y1995#c.zbetweenness  y1996#c.zbetweenness y1997#c.zbetweenness ///
			y1998#c.zbetweenness y1999#c.zbetweenness  y2000#c.zbetweenness y2001#c.zbetweenness ///
			y2002#c.zbetweenness y2003#c.zbetweenness  y2004#c.zbetweenness y2005#c.zbetweenness ///
			y2006#c.zbetweenness y2007#c.zbetweenness  ///
			zbetweenness  [pweight=p_weights] if sample_weight == 1, ///
			absorb(year id) cluster(id) nocons
			
			eststo
			
			
			
			capture cd "$tables"
esttab est* using "tableA11.tex", replace nonumber label style(tex) ///
    cells(b(star fmt(%12.4fc)) se(par fmt(%12.4fc))) ///
    stats( N r2 , fmt( %12.0fc %12.4fc ) ///
        label("\hline Observations"  ///
          "\$R^2\$" )) ///
    keep( 1.y1971#c.zbetweenness 1.y1972#c.zbetweenness 1.y1973#c.zbetweenness 1.y1974#c.zbetweenness 1.y1975#c.zbetweenness ///
    1.y1976#c.zbetweenness 1.y1977#c.zbetweenness 1.y1978#c.zbetweenness 1.y1979#c.zbetweenness 1.y1980#c.zbetweenness ///
    1.y1981#c.zbetweenness 1.y1982#c.zbetweenness 1.y1983#c.zbetweenness 1.y1984#c.zbetweenness 1.y1985#c.zbetweenness ///
    1.y1986#c.zbetweenness 1.y1987#c.zbetweenness 1.y1988#c.zbetweenness 1.y1990#c.zbetweenness 1.y1991#c.zbetweenness ///
    1.y1992#c.zbetweenness 1.y1993#c.zbetweenness 1.y1994#c.zbetweenness 1.y1995#c.zbetweenness 1.y1996#c.zbetweenness ///
    1.y1997#c.zbetweenness 1.y1998#c.zbetweenness 1.y1999#c.zbetweenness 1.y2000#c.zbetweenness 1.y2001#c.zbetweenness ///
    1.y2002#c.zbetweenness 1.y2003#c.zbetweenness 1.y2004#c.zbetweenness 1.y2005#c.zbetweenness 1.y2006#c.zbetweenness ///
    1.y2007#c.zbetweenness) ///    
    order(1.y1971#c.zbetweenness 1.y1972#c.zbetweenness 1.y1973#c.zbetweenness 1.y1974#c.zbetweenness 1.y1975#c.zbetweenness ///
    1.y1976#c.zbetweenness 1.y1977#c.zbetweenness 1.y1978#c.zbetweenness 1.y1979#c.zbetweenness 1.y1980#c.zbetweenness ///
    1.y1981#c.zbetweenness 1.y1982#c.zbetweenness 1.y1983#c.zbetweenness 1.y1984#c.zbetweenness 1.y1985#c.zbetweenness ///
    1.y1986#c.zbetweenness 1.y1987#c.zbetweenness 1.y1988#c.zbetweenness 1.y1990#c.zbetweenness 1.y1991#c.zbetweenness ///
    1.y1992#c.zbetweenness 1.y1993#c.zbetweenness 1.y1994#c.zbetweenness 1.y1995#c.zbetweenness 1.y1996#c.zbetweenness ///
    1.y1997#c.zbetweenness 1.y1998#c.zbetweenness 1.y1999#c.zbetweenness 1.y2000#c.zbetweenness 1.y2001#c.zbetweenness ///
    1.y2002#c.zbetweenness 1.y2003#c.zbetweenness 1.y2004#c.zbetweenness 1.y2005#c.zbetweenness 1.y2006#c.zbetweenness ///
    1.y2007#c.zbetweenness ) ///
    varlabels(1.y1971#c.zbetweenness "Year 1971 \$\times\$ Betweenness" 1.y1972#c.zbetweenness "Year 1972 \$\times\$ Betweenness" ///
    1.y1973#c.zbetweenness "Year 1973 \$\times\$ Betweenness" 1.y1974#c.zbetweenness "Year 1974 \$\times\$ Betweenness" ///
    1.y1975#c.zbetweenness "Year 1975 \$\times\$ Betweenness" 1.y1976#c.zbetweenness "Year 1976 \$\times\$ Betweenness" ///
    1.y1977#c.zbetweenness "Year 1977 \$\times\$ Betweenness" 1.y1978#c.zbetweenness "Year 1978 \$\times\$ Betweenness" ///
    1.y1979#c.zbetweenness "Year 1979 \$\times\$ Betweenness" 1.y1980#c.zbetweenness "Year 1980 \$\times\$ Betweenness" ///
    1.y1981#c.zbetweenness "Year 1981 \$\times\$ Betweenness" 1.y1982#c.zbetweenness "Year 1982 \$\times\$ Betweenness" ///
    1.y1983#c.zbetweenness "Year 1983 \$\times\$ Betweenness" 1.y1984#c.zbetweenness "Year 1984 \$\times\$ Betweenness" ///
    1.y1985#c.zbetweenness "Year 1985 \$\times\$ Betweenness" 1.y1986#c.zbetweenness "Year 1986 \$\times\$ Betweenness" ///
    1.y1987#c.zbetweenness "Year 1987 \$\times\$ Betweenness" 1.y1988#c.zbetweenness "Year 1988 \$\times\$ Betweenness" ///
    1.y1990#c.zbetweenness "Year 1990 \$\times\$ Betweenness" 1.y1991#c.zbetweenness "Year 1991 \$\times\$ Betweenness" ///
    1.y1992#c.zbetweenness "Year 1992 \$\times\$ Betweenness" 1.y1993#c.zbetweenness "Year 1993 \$\times\$ Betweenness" ///
    1.y1994#c.zbetweenness "Year 1994 \$\times\$ Betweenness" 1.y1995#c.zbetweenness "Year 1995 \$\times\$ Betweenness" ///
    1.y1996#c.zbetweenness "Year 1996 \$\times\$ Betweenness" 1.y1997#c.zbetweenness "Year 1997 \$\times\$ Betweenness" ///
    1.y1998#c.zbetweenness "Year 1998 \$\times\$ Betweenness" 1.y1999#c.zbetweenness "Year 1999 \$\times\$ Betweenness" ///
    1.y2000#c.zbetweenness "Year 2000 \$\times\$ Betweenness" 1.y2001#c.zbetweenness "Year 2001 \$\times\$ Betweenness" ///
    1.y2002#c.zbetweenness "Year 2002 \$\times\$ Betweenness" 1.y2003#c.zbetweenness "Year 2003 \$\times\$ Betweenness" ///
    1.y2004#c.zbetweenness "Year 2004 \$\times\$ Betweenness" 1.y2005#c.zbetweenness "Year 2005 \$\times\$ Betweenness" ///
    1.y2006#c.zbetweenness "Year 2006 \$\times\$ Betweenness" 1.y2007#c.zbetweenness "Year 2007 \$\times\$ Betweenness") ///    
    collabels(, none) eqlabels(, none) starlevels(* 0.1 ** 0.05 *** 0.01) ///
    prehead(\begin{tabular}{l*{@M}{c}} \hline ///
        &  \multicolumn{1}{c}{Hectares (log)}  & \multicolumn{1}{c}{Land grant (binary)}  \\ ///
        & (1) & (2)   \\)  ///
    posthead(\hline ) mlabels(, none) ///
    prefoot( ) postfoot(\hline \end{tabular})
			
